/*
 * @Date: 2020-08-27 16:56:46
 */
import { useState, useEffect } from 'react'

export default function useTimeStatus() {
  const [times, setTimes] = useState(new Date())

  useEffect(() => {
    const timer = setInterval(() => {
      setTimes(new Date())
    }, 1000)

    return () => {
      console.log(1)
      clearInterval(timer)
    }
  }, [])
  return {
    times
  }
}
